<!--
* description: 选装包查询
* author: liks
* createdDate: 2020-02-27
-->
<template>
  <section class="carTypeConfig">
    <el-dialog v-dialogDrag
      title="选装包查询"
      :visible.sync="curPopupsVisible"
      width="1000px"
      center
      @close="sendCode"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
      <dialogHeader
        slot="title"
        :title="'选装包查询'"
        :styleType="$store.state.app.dialogType"
      ></dialogHeader>
      <one-table-template
        ref="multipleTable"
        :dynamicButtons="tableButtons"
        :dynamicComponents="tableComponents"
        :dynamicApiConfig="apiConfig"
        :dynamicTableCols="tableCols"
        :dynamicFormFields="formField"
        :dynamicIsShowSelect="isMul"
        :dynamicIsInitTable="true"
      />
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/commonComponents/crmPopupsOneTable";

export default {
  // 组件混入对象：{data[listQuery] methods[queryTable]}
  mixins: [oneTableWithViewTemplateMixins, valueObjectMixins],
  components: {
    OneTableTemplate,
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  data() {
    return {
      // 网格查询API配置对象
      apiConfig: crmApis.mdmCarOptionalPackQueryFindAll, //经销商查询
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "primary",
          size: "small",
          clickEvent: () => this.queryTable(1),
          text: "查询",
          position: "top"
        },
        {
          compKey: "btnKey2",
          type: "primary",
          size: "small",
          clickEvent: () => this.sendCode(this.codeField, "optionalShortName"),
          text: "确认",
          position: "bottom"
        },
        {
          compKey: "btnKey3",
          type: "",
          size: "small",
          clickEvent: () => this.reset(),
          text: "重置",
          position: "top"
        }
      ],
      // 动态组件-查询条件
      tableComponents: [
        // 显示组件

        {
          compKey: "compKey2",
          labelName: "选装包编码",
          codeField: "optionalPackCode",
          component: () => import("@/components/crm/textbox/crmTextInput"),
          type: "inputText",
          isMust: true
        },
        {
          compKey: "compKey1",
          labelName: "选装包名称",
          codeField: "optionalPackCn",
          component: () => import("@/components/crm/textbox/crmTextInput"),
          type: "inputText",
          isMust: true
        },
        {
          compKey: "compKey3",
          labelName: "选装包简称",
          codeField: "optionalShortName",
          component: () => import("@/components/crm/textbox/crmTextInput"),
          type: "inputText",
          isMust: true
        },
      ],
      // 动态生成网格列
      tableCols: [
            {
          prop: "carBrandCode",
          label: "品牌编码",
          width: 0,
          align: "center",
          hidden: true
        }, // 品牌编码
        {
          prop: "productLevelTypeName",
          label: "产品层次类型名称",
          width: 120,
          align: "center",
          hidden: true
        }, // 产品层次类型名称
        {
          prop: "productLevelType",
          label: "产品层次类型编码",
          width: 120,
          align: "center",
          hidden: true
        }, // 产品层次类型编码
        {
          prop: "productLevelId",
          label: "产品层次ID",
          width: 0,
          align: "center",
          hidden: true
        }, // 产品层次ID
        {
          prop: "productLevelCode",
          label: "产品层次编码",
          width: 0,
          align: "center",
          hidden: true
        }, // 产品层次编码
        {
          prop: "carSeriesCn",
          label: "车系名称",
          width: null,
          align: "center"
        },
        {
          prop: 'smallCarTypeCode',
          label: '车型编码',
          width: null,
          align: 'center'
        },
        {
          prop: 'smallCarTypeCn',
          label: '车型',
          width: 200,
          align: 'center'
        },
        {
          prop: "optionalPackId",
          label: "选装包ID",
          width: 0,
          align: "center",
          hidden: true
        }, // 选装包ID
        {
          prop: "optionalPackCode",
          label: "选装包编码",
          width: null,
          align: "center"
        }, // 选装包编码
        {
          prop: "optionalPackCn",
          label: "选装包名称",
          width: null,
          align: "center"
        }, // 选装包名称
        {
          prop: 'optionalShortName',
          label: '选装包简称',
          width: null,
          align: 'center'
        },
        {
          prop: "supplyStatusCn",
          label: "供应状态",
          width: 80,
          align: "center"
        }
      ],
      //表单查询数据（查询条件）
      formField: {
        optionalPackCode: "",
        optionalPackCn: "",
        optionalShortName:"",
        smallCarTypeId: "",
        isEnable: "1"
      },
      handleTableRowData: {
        value: this.codeField,
        text: "optionalShortName"
      }
    };
  },
  mounted() {
    this.formField.isEnable = "1";
    // if(this.$store.getters.orgInfo.ORG_TYPE&&this.$store.getters.orgInfo.ORG_TYPE=='1'){//ORG_TYPE为0是主机厂，为1是经销商
    //   this.formField.specCurAuthorOnly='1';//此字段用于筛选网点
    // }
  },
  methods: {}
};
</script>
